package top.yamhk.plugin.dynamic;

import cn.hutool.system.SystemUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;

/**
 * #
 * implements Cloneable
 *
 * @author ywwb1795
 */
@Slf4j
@Component
public class ReMockRefAtDev extends URLClassLoader {
    /**
     * targetDir
     */
    public static String targetDir = "";

    static {
        if (SystemUtil.getOsInfo().isWindows()) {
            targetDir = "C:" + "/root/hk/trans";
        } else {
            targetDir = "/root/hk/trans";
        }
    }

    public ReMockRefAtDev() throws MalformedURLException {
        super(new URL[]{new File(targetDir + "/demoModule-1.0.0.RELEASE.jar").toURI().toURL()});
    }

    public ReMockRefAtDev(URL[] urls) {
        super(urls);
    }
}
